<txp:rvm_privileged />
<txp:php>
// countdown function
// parameters: (year, month, day, hour, minute)

//--------------------------
// author: Louai Munajim
// website: www.elouai.com
//
// Note:
// Unix timestamp limitations 
// Date range is from 
// the year 1970 to 2038
//--------------------------
function countdown($year, $month, $day, $hour, $minute)
{
  // make a unix timestamp for the given date
  $the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);

  // get current unix timestamp
  $today = time();

  $difference = $the_countdown_date - $today;
  if ($difference < 0) $difference = 0;

  $days_left = floor($difference/60/60/24);
  $hours_left = floor(($difference - $days_left*60*60*24)/60/60);
  $minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);

  // OUTPUT
  echo "Today's date ".date("F j, Y, g:i a")."<br/>";
  echo "Countdown date ".date("F j, Y, g:i a",$the_countdown_date)."<br/>";
  echo "Countdown ".$days_left." days ".$hours_left." hours ".$minutes_left." minutes left";
}
</txp:php>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Auto Complete Test</title>
<txp:rvm_css format="link" n="autocomplete" />
<!--Call jQuery-->
<script type="text/javascript" src="/textpattern/jquery.js"></script>
<txp:js n="jquery.autocomplete.js" />

<script type="text/javascript" src="http://photographdaddy.com/?rah_external_output=autocomplete"></script>
<script type="text/javascript">
    $(function(){
		$("#myTextInputID").autocomplete(options);
    });
</script>
</head>
<body>
<input type="text" id="myTextInputID" />
<txp:article_custom id="69">
<h2><txp:title/></h2>
<ul><li>expires <txp:php>echo expires(array("format" => "%Y,%m,%d,%H,%M"));</txp:php></li>
<li>Year - <txp:php>echo expires(array("format" => "%Y"));</txp:php></li>
<li><txp:php>countdown(expires(array("format" => "%Y")),expires(array("format" => "%m")),expires(array("format" => "%d")),expires(array("format" => "%H")),expires(array("format" => "%M")));
</txp:php></li>
</ul>

</txp:article_custom>


</body>
</html>
